
//页面跳转
function toIndex(){
	var url = basePath+"/bus/meter/list";
	window.location.href=url;
}

//获取table每一行数据
function getTableValue(status){
		if(checkInput()){
			//获取计划信息
			var meterResult = [];
			var modelCode= $("#modelCode").val();// 部品番号
			var useFor = $("#useFor").val();// 用途
			var grow = $("#grow").val();// 长
			var wide = $("#wide").val();// 幅
			var tall = $("#tall").val();// 板厚
			var planNum = $("#planNum").val();// 计划枚数
			var perNum = $("#perNum").val();// 每枚可取数
			var planAmount = $("#planAmount").val();//可取台数
			var giveTime = $("#giveTime").val();// 下发时间
			var operator = $("#operator").val();// 下发人
			var jhdata = {
					modelCode : modelCode,
					useFor : useFor,
					grow : grow,
					wide : wide,
					tall : tall,
					planNum : planNum,
					perNum : perNum,
					planAmount : planAmount,
					giveTime : giveTime,
					operator : operator,
					status:status
				};
			meterResult.push(jhdata);
			var url = basePath+"/bus/meter/saveModelMeter"
			showLoad();//加载层
				$.ajax({
					type : "post",
					url : url,
					data : {meterData:JSON.stringify(meterResult)},
					dataType : "json",
					success : function(data) {
						msgPrompt(data.message);
                        setTimeout("tempBarck()","1000");
					}
				});
		}
		
	}

function tempBarck() {
    window.location.href = basePath + '/bus/meter/returnMeterGive?url=' + basePath + '/bus/meter/list&flg=queryPageBusModelMeter';
}
	
function checkInput(){
	var modelCode = $("#modelCode").val();// 部品番号
	var useFor = $("#useFor").val();// 用途
	var grow = $("#grow").val();// 长
	var wide = $("#wide").val();// 幅
	var tall = $("#tall").val();// 板厚
	var planNum = $("#planNum").val();// 计划枚数
	var perNum = $("#perNum").val();// 每枚可取数
	var planAmount = $("#planAmount").val();//可取台数
	var giveTime = $("#giveTime").val();// 下发时间
	var operator = $("#operator").val();// 下发人
	var avaliablAmount = $("#avaliablAmount").val();//剩余库存
	if(modelCode == null || modelCode == undefined || modelCode == ""){
		msgFeedBack("部品番号不能为空","#modelCode");
		return false;
	}
	if(useFor == null || useFor == undefined || useFor == ""){
		msgFeedBack("用途不能为空","#useFor");
		return false;
	}
	if(grow == null || grow == undefined || grow == ""){
		msgFeedBack("长不能为空","#grow");
		return false;
	}
	if(wide == null || wide == undefined || wide == ""){
		msgFeedBack("幅不能为空","#wide");
		return false;
	}
	if(tall == null || tall == undefined || tall == ""){
		msgFeedBack("板厚不能为空","#tall");
		return false;
	}
	if(planNum == null || planNum == undefined || planNum == ""){
		msgFeedBack("计划枚数不能为空","#planNum");
		return false;
	}else if(Number(planNum)>Number(avaliablAmount)){
		msgFeedBack("库存不足","#planNum");
		return false;
	}
	if(perNum == null || perNum == undefined || perNum == ""){
		msgFeedBack("每枚可取数不能为空","#perNum");
		return false;
	}
	if(planAmount == null || planAmount == undefined || planAmount == ""){
		msgFeedBack("可取台数不能为空","#planAmount");
		return false;
	}
	if(giveTime == null || giveTime == undefined || giveTime == ""){
		msgFeedBack("下发时间不能为空","#giveTime");
		return false;
	}
	if(operator == null || operator == undefined || operator == ""){
		msgFeedBack("下发人不能为空","#operator");
		return false;
	}
	return true;
}
